package com.fqgj.sentry.controller.antiFraud.response.anti;

import com.fqgj.sentry.biz.antiFraud.domain.PropertyTypeEnums;
import com.fqgj.sentry.biz.antiFraud.domain.OrderVo;
import com.fqgj.sentry.biz.antiFraud.domain.PropertyVo;
import com.fqgj.sentry.controller.antiFraud.response.anti.relation.NodeLinkDataUtil;
import com.fqgj.sentry.controller.antiFraud.response.anti.relation.NodeLinkInfo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created by liupengpeng on 2017/10/17.
 */
public class AntiFraudDataUtil implements Serializable {
    public static OrderVo getAntiFraudVo() {

        OrderVo orderVo = getOrderDetail(1, "张三", "2017-10-16");
        List<PropertyVo> propertyVoList = new ArrayList<>();


        PropertyVo propertyVo = new PropertyVo(2 + "");
        propertyVo.setPropertyTypeEnums(PropertyTypeEnums.companyName);
        List<OrderVo> orderVoList = new ArrayList<>();
        OrderVo order1 = getOrderDetail(3, "张三", "2017-09-22");
        OrderVo order2 = getOrderDetail(4, "张四", "2017-09-22");
        OrderVo order3 = getOrderDetail(5, "张五", "2017-09-22");
        orderVoList.add(order1);
        orderVoList.add(order2);
        orderVoList.add(order3);
        propertyVo.setOrderVoList(orderVoList);
        propertyVoList.add(propertyVo);


        PropertyVo bank = new PropertyVo(6 + "");
        bank.setPropertyTypeEnums(PropertyTypeEnums.identityNO);
        List<OrderVo> bankOrderList = new ArrayList<>();
        OrderVo order4 = getOrderDetail(5, "张五", "2017-09-22");
        bankOrderList.add(order4);
        bank.setOrderVoList(bankOrderList);
        propertyVoList.add(bank);


        PropertyVo qq = new PropertyVo(7 + "");
        qq.setPropertyTypeEnums(PropertyTypeEnums.qq);
        List<OrderVo> qqOrderList = new ArrayList<>();
        OrderVo order5 = getOrderDetail(8, "张九", "2017-09-22");
        qqOrderList.add(order5);
        qq.setOrderVoList(qqOrderList);
        propertyVoList.add(qq);


        PropertyVo device = new PropertyVo(9 + "");
        device.setPropertyTypeEnums(PropertyTypeEnums.device);
        List<OrderVo> deviceOrderList = new ArrayList<>();
        OrderVo order6 = getOrderDetail(10, "张六", "2017-09-22");
        List<PropertyVo> order6PropertyVoList = new ArrayList<>();
        PropertyVo order6Relation1 = new PropertyVo(11 + "");
        order6Relation1.setPropertyTypeEnums(PropertyTypeEnums.qq);
        List<OrderVo> order6OrderList = new ArrayList<>();
        OrderVo order14 = getOrderDetail(12, "王五", "2017-09-22");
        OrderVo order15 = getOrderDetail(4, "张四", "2017-09-22");
        order6OrderList.add(order14);
        order6OrderList.add(order15);
        order6Relation1.setOrderVoList(order6OrderList);
        order6PropertyVoList.add(order6Relation1);
        order6.setPropertyVoList(order6PropertyVoList);

        OrderVo order7 = getOrderDetail(13, "张七", "2017-09-22");
        deviceOrderList.add(order6);
        deviceOrderList.add(order7);
        device.setOrderVoList(deviceOrderList);
        propertyVoList.add(device);


        PropertyVo wifi = new PropertyVo(14 + "");
        wifi.setPropertyTypeEnums(PropertyTypeEnums.wifi);
        List<OrderVo> wifiOrderList = new ArrayList<>();
        OrderVo order8 = getOrderDetail(5, "张五", "2017-09-22");
        wifiOrderList.add(order8);
        wifi.setOrderVoList(wifiOrderList);
        propertyVoList.add(wifi);


        PropertyVo companyPhone = new PropertyVo(15 + "");
        companyPhone.setPropertyTypeEnums(PropertyTypeEnums.companyPhone);
        List<OrderVo> companyPhoneOrderList = new ArrayList<>();
        OrderVo order9 = getOrderDetail(16, "张八", "2017-09-22");
        List<PropertyVo> order9PropertyVoList = new ArrayList<>();
        PropertyVo order9Property = new PropertyVo(17 + "");
        order9Property.setPropertyTypeEnums(PropertyTypeEnums.contactMobile1);
        List<OrderVo> order9OrderList = new ArrayList<>();
        OrderVo order12 = getOrderDetail(8, "张九", "2017-09-22");
        OrderVo order13 = getOrderDetail(4, "张四", "2017-09-22");
        order9OrderList.add(order12);
        order9OrderList.add(order13);
        order9Property.setOrderVoList(order9OrderList);
        order9PropertyVoList.add(order9Property);
        order9.setPropertyVoList(order9PropertyVoList);
        companyPhoneOrderList.add(order9);
        companyPhone.setOrderVoList(companyPhoneOrderList);
        propertyVoList.add(companyPhone);


        PropertyVo relation1 = new PropertyVo(18 + "");
        relation1.setPropertyTypeEnums(PropertyTypeEnums.contactMobile1);
        List<OrderVo> relation1OrderList = new ArrayList<>();
        OrderVo order10 = getOrderDetail(13, "张七", "2017-09-22");
        relation1OrderList.add(order10);
        relation1.setOrderVoList(relation1OrderList);
        propertyVoList.add(relation1);


        PropertyVo relation2 = new PropertyVo(19 + "");
        relation2.setPropertyTypeEnums(PropertyTypeEnums.contactMobile1);
        List<OrderVo> relation2OrderList = new ArrayList<>();
        OrderVo order11 = getOrderDetail(16, "张八", "2017-09-22");
        relation2OrderList.add(order11);
        relation2.setOrderVoList(relation2OrderList);
        propertyVoList.add(relation2);

        orderVo.setPropertyVoList(propertyVoList);
        return orderVo;

    }


    private static OrderVo getOrderDetail(Integer num, String realName, String applyDate) {
        OrderVo orderVo = new OrderVo();
        Integer randomNum = new Random().nextInt(2);

        orderVo.setNo(num + "")
                .setApplyDate(applyDate)
                .setFrom("fqgj")
                .setNew(randomNum == 1 ? true : false)
                .setLastOverdue(randomNum == 1 ? true : false)
                .setRealName(realName)
                .setMobile("18356051430")
                .setIdentityNO("3411222129987765432579")
                .setBankNO("3411222129987765432579")
                .setBankName("中国银行")
                .setQq("1232142134")
                .setCompanyName("分期管家")
                .setCompanyAddress("杭州西溪湿地")
                .setCompanyPhone("12321312")
                .setContactRelation1("父母")
                .setContactName1("张思")
                .setContactMobile1("1231231")
                .setContactRelation2("朋友")
                .setContactMobile2("1232434")
                .setContactName2("张思")
                .setRiskResult("reject")
                .setRiskResultPriority(randomNum)
                .setRiskResultPriority(randomNum)
                .setRule("规则1，规则2")
                .setGpsAddress("浙江省杭州市西湖区西溪湿地");
        return orderVo;
    }


    public static void main(String[] args) {
        OrderVo orderVo = getAntiFraudVo();
        NodeLinkInfo nodeLinkInfo = NodeLinkDataUtil.drawOrderPropertyOrder(orderVo);
        System.out.println();
    }
}
